/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
import * as $protobuf from "protobufjs/minimal";

// Common aliases
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;

// Exported root namespace
const $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});

export const Header = $root.Header = (() => {

    /**
     * Properties of a Header.
     * @exports IHeader
     * @interface IHeader
     * @property {number|null} [command] Header command
     * @property {string|null} [version] Header version
     * @property {string|null} [projectCode] Header projectCode
     * @property {string|null} [reqId] Header reqId
     */

    /**
     * Constructs a new Header.
     * @exports Header
     * @classdesc Represents a Header.
     * @implements IHeader
     * @constructor
     * @param {IHeader=} [properties] Properties to set
     */
    function Header(properties) {
        if (properties)
            for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * Header command.
     * @member {number} command
     * @memberof Header
     * @instance
     */
    Header.prototype.command = 0;

    /**
     * Header version.
     * @member {string} version
     * @memberof Header
     * @instance
     */
    Header.prototype.version = "";

    /**
     * Header projectCode.
     * @member {string} projectCode
     * @memberof Header
     * @instance
     */
    Header.prototype.projectCode = "";

    /**
     * Header reqId.
     * @member {string} reqId
     * @memberof Header
     * @instance
     */
    Header.prototype.reqId = "";

    /**
     * Creates a new Header instance using the specified properties.
     * @function create
     * @memberof Header
     * @static
     * @param {IHeader=} [properties] Properties to set
     * @returns {Header} Header instance
     */
    Header.create = function create(properties) {
        return new Header(properties);
    };

    /**
     * Encodes the specified Header message. Does not implicitly {@link Header.verify|verify} messages.
     * @function encode
     * @memberof Header
     * @static
     * @param {IHeader} message Header message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Header.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.command != null && Object.hasOwnProperty.call(message, "command"))
            writer.uint32(/* id 1, wireType 0 =*/8).int32(message.command);
        if (message.version != null && Object.hasOwnProperty.call(message, "version"))
            writer.uint32(/* id 3, wireType 2 =*/26).string(message.version);
        if (message.projectCode != null && Object.hasOwnProperty.call(message, "projectCode"))
            writer.uint32(/* id 4, wireType 2 =*/34).string(message.projectCode);
        if (message.reqId != null && Object.hasOwnProperty.call(message, "reqId"))
            writer.uint32(/* id 5, wireType 2 =*/42).string(message.reqId);
        return writer;
    };

    /**
     * Encodes the specified Header message, length delimited. Does not implicitly {@link Header.verify|verify} messages.
     * @function encodeDelimited
     * @memberof Header
     * @static
     * @param {IHeader} message Header message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Header.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a Header message from the specified reader or buffer.
     * @function decode
     * @memberof Header
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {Header} Header
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Header.decode = function decode(reader, length, error) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Header();
        while (reader.pos < end) {
            let tag = reader.uint32();
            if (tag === error)
                break;
            switch (tag >>> 3) {
            case 1: {
                    message.command = reader.int32();
                    break;
                }
            case 3: {
                    message.version = reader.string();
                    break;
                }
            case 4: {
                    message.projectCode = reader.string();
                    break;
                }
            case 5: {
                    message.reqId = reader.string();
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a Header message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof Header
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {Header} Header
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Header.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a Header message.
     * @function verify
     * @memberof Header
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    Header.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        if (message.command != null && message.hasOwnProperty("command"))
            if (!$util.isInteger(message.command))
                return "command: integer expected";
        if (message.version != null && message.hasOwnProperty("version"))
            if (!$util.isString(message.version))
                return "version: string expected";
        if (message.projectCode != null && message.hasOwnProperty("projectCode"))
            if (!$util.isString(message.projectCode))
                return "projectCode: string expected";
        if (message.reqId != null && message.hasOwnProperty("reqId"))
            if (!$util.isString(message.reqId))
                return "reqId: string expected";
        return null;
    };

    /**
     * Creates a Header message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof Header
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {Header} Header
     */
    Header.fromObject = function fromObject(object) {
        if (object instanceof $root.Header)
            return object;
        let message = new $root.Header();
        if (object.command != null)
            message.command = object.command | 0;
        if (object.version != null)
            message.version = String(object.version);
        if (object.projectCode != null)
            message.projectCode = String(object.projectCode);
        if (object.reqId != null)
            message.reqId = String(object.reqId);
        return message;
    };

    /**
     * Creates a plain object from a Header message. Also converts values to other types if specified.
     * @function toObject
     * @memberof Header
     * @static
     * @param {Header} message Header
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    Header.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        let object = {};
        if (options.defaults) {
            object.command = 0;
            object.version = "";
            object.projectCode = "";
            object.reqId = "";
        }
        if (message.command != null && message.hasOwnProperty("command"))
            object.command = message.command;
        if (message.version != null && message.hasOwnProperty("version"))
            object.version = message.version;
        if (message.projectCode != null && message.hasOwnProperty("projectCode"))
            object.projectCode = message.projectCode;
        if (message.reqId != null && message.hasOwnProperty("reqId"))
            object.reqId = message.reqId;
        return object;
    };

    /**
     * Converts this Header to JSON.
     * @function toJSON
     * @memberof Header
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    Header.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for Header
     * @function getTypeUrl
     * @memberof Header
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    Header.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/Header";
    };

    return Header;
})();

export const ChatPack = $root.ChatPack = (() => {

    /**
     * Properties of a ChatPack.
     * @exports IChatPack
     * @interface IChatPack
     * @property {string|null} [sender] 发送者
     * @property {string|null} [recipient] 接收人
     * @property {number|null} [mediaType] 消息类型 参考 MediaType
     * @property {string|null} [content] 消息体
     */

    /**
     * Constructs a new ChatPack.
     * @exports ChatPack
     * @classdesc 聊天数据包
     * @implements IChatPack
     * @constructor
     * @param {IChatPack=} [properties] Properties to set
     */
    function ChatPack(properties) {
        if (properties)
            for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * 发送者
     * @member {string} sender
     * @memberof ChatPack
     * @instance
     */
    ChatPack.prototype.sender = "";

    /**
     * 接收人
     * @member {string} recipient
     * @memberof ChatPack
     * @instance
     */
    ChatPack.prototype.recipient = "";

    /**
     * 消息类型 参考 MediaType
     * @member {number} mediaType
     * @memberof ChatPack
     * @instance
     */
    ChatPack.prototype.mediaType = 0;

    /**
     * 消息体
     * @member {string} content
     * @memberof ChatPack
     * @instance
     */
    ChatPack.prototype.content = "";

    /**
     * Creates a new ChatPack instance using the specified properties.
     * @function create
     * @memberof ChatPack
     * @static
     * @param {IChatPack=} [properties] Properties to set
     * @returns {ChatPack} ChatPack instance
     */
    ChatPack.create = function create(properties) {
        return new ChatPack(properties);
    };

    /**
     * Encodes the specified ChatPack message. Does not implicitly {@link ChatPack.verify|verify} messages.
     * @function encode
     * @memberof ChatPack
     * @static
     * @param {IChatPack} message ChatPack message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    ChatPack.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.sender != null && Object.hasOwnProperty.call(message, "sender"))
            writer.uint32(/* id 1, wireType 2 =*/10).string(message.sender);
        if (message.recipient != null && Object.hasOwnProperty.call(message, "recipient"))
            writer.uint32(/* id 2, wireType 2 =*/18).string(message.recipient);
        if (message.mediaType != null && Object.hasOwnProperty.call(message, "mediaType"))
            writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mediaType);
        if (message.content != null && Object.hasOwnProperty.call(message, "content"))
            writer.uint32(/* id 4, wireType 2 =*/34).string(message.content);
        return writer;
    };

    /**
     * Encodes the specified ChatPack message, length delimited. Does not implicitly {@link ChatPack.verify|verify} messages.
     * @function encodeDelimited
     * @memberof ChatPack
     * @static
     * @param {IChatPack} message ChatPack message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    ChatPack.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a ChatPack message from the specified reader or buffer.
     * @function decode
     * @memberof ChatPack
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {ChatPack} ChatPack
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    ChatPack.decode = function decode(reader, length, error) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        let end = length === undefined ? reader.len : reader.pos + length, message = new $root.ChatPack();
        while (reader.pos < end) {
            let tag = reader.uint32();
            if (tag === error)
                break;
            switch (tag >>> 3) {
            case 1: {
                    message.sender = reader.string();
                    break;
                }
            case 2: {
                    message.recipient = reader.string();
                    break;
                }
            case 3: {
                    message.mediaType = reader.int32();
                    break;
                }
            case 4: {
                    message.content = reader.string();
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a ChatPack message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof ChatPack
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {ChatPack} ChatPack
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    ChatPack.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a ChatPack message.
     * @function verify
     * @memberof ChatPack
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    ChatPack.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        if (message.sender != null && message.hasOwnProperty("sender"))
            if (!$util.isString(message.sender))
                return "sender: string expected";
        if (message.recipient != null && message.hasOwnProperty("recipient"))
            if (!$util.isString(message.recipient))
                return "recipient: string expected";
        if (message.mediaType != null && message.hasOwnProperty("mediaType"))
            if (!$util.isInteger(message.mediaType))
                return "mediaType: integer expected";
        if (message.content != null && message.hasOwnProperty("content"))
            if (!$util.isString(message.content))
                return "content: string expected";
        return null;
    };

    /**
     * Creates a ChatPack message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof ChatPack
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {ChatPack} ChatPack
     */
    ChatPack.fromObject = function fromObject(object) {
        if (object instanceof $root.ChatPack)
            return object;
        let message = new $root.ChatPack();
        if (object.sender != null)
            message.sender = String(object.sender);
        if (object.recipient != null)
            message.recipient = String(object.recipient);
        if (object.mediaType != null)
            message.mediaType = object.mediaType | 0;
        if (object.content != null)
            message.content = String(object.content);
        return message;
    };

    /**
     * Creates a plain object from a ChatPack message. Also converts values to other types if specified.
     * @function toObject
     * @memberof ChatPack
     * @static
     * @param {ChatPack} message ChatPack
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    ChatPack.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        let object = {};
        if (options.defaults) {
            object.sender = "";
            object.recipient = "";
            object.mediaType = 0;
            object.content = "";
        }
        if (message.sender != null && message.hasOwnProperty("sender"))
            object.sender = message.sender;
        if (message.recipient != null && message.hasOwnProperty("recipient"))
            object.recipient = message.recipient;
        if (message.mediaType != null && message.hasOwnProperty("mediaType"))
            object.mediaType = message.mediaType;
        if (message.content != null && message.hasOwnProperty("content"))
            object.content = message.content;
        return object;
    };

    /**
     * Converts this ChatPack to JSON.
     * @function toJSON
     * @memberof ChatPack
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    ChatPack.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for ChatPack
     * @function getTypeUrl
     * @memberof ChatPack
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    ChatPack.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/ChatPack";
    };

    return ChatPack;
})();

export const AuthPack = $root.AuthPack = (() => {

    /**
     * Properties of an AuthPack.
     * @exports IAuthPack
     * @interface IAuthPack
     * @property {string|null} [cipherText] AuthPack cipherText
     * @property {string|null} [secretKey] AuthPack secretKey
     */

    /**
     * Constructs a new AuthPack.
     * @exports AuthPack
     * @classdesc Represents an AuthPack.
     * @implements IAuthPack
     * @constructor
     * @param {IAuthPack=} [properties] Properties to set
     */
    function AuthPack(properties) {
        if (properties)
            for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * AuthPack cipherText.
     * @member {string} cipherText
     * @memberof AuthPack
     * @instance
     */
    AuthPack.prototype.cipherText = "";

    /**
     * AuthPack secretKey.
     * @member {string} secretKey
     * @memberof AuthPack
     * @instance
     */
    AuthPack.prototype.secretKey = "";

    /**
     * Creates a new AuthPack instance using the specified properties.
     * @function create
     * @memberof AuthPack
     * @static
     * @param {IAuthPack=} [properties] Properties to set
     * @returns {AuthPack} AuthPack instance
     */
    AuthPack.create = function create(properties) {
        return new AuthPack(properties);
    };

    /**
     * Encodes the specified AuthPack message. Does not implicitly {@link AuthPack.verify|verify} messages.
     * @function encode
     * @memberof AuthPack
     * @static
     * @param {IAuthPack} message AuthPack message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    AuthPack.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.cipherText != null && Object.hasOwnProperty.call(message, "cipherText"))
            writer.uint32(/* id 1, wireType 2 =*/10).string(message.cipherText);
        if (message.secretKey != null && Object.hasOwnProperty.call(message, "secretKey"))
            writer.uint32(/* id 2, wireType 2 =*/18).string(message.secretKey);
        return writer;
    };

    /**
     * Encodes the specified AuthPack message, length delimited. Does not implicitly {@link AuthPack.verify|verify} messages.
     * @function encodeDelimited
     * @memberof AuthPack
     * @static
     * @param {IAuthPack} message AuthPack message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    AuthPack.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes an AuthPack message from the specified reader or buffer.
     * @function decode
     * @memberof AuthPack
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {AuthPack} AuthPack
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    AuthPack.decode = function decode(reader, length, error) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        let end = length === undefined ? reader.len : reader.pos + length, message = new $root.AuthPack();
        while (reader.pos < end) {
            let tag = reader.uint32();
            if (tag === error)
                break;
            switch (tag >>> 3) {
            case 1: {
                    message.cipherText = reader.string();
                    break;
                }
            case 2: {
                    message.secretKey = reader.string();
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes an AuthPack message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof AuthPack
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {AuthPack} AuthPack
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    AuthPack.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies an AuthPack message.
     * @function verify
     * @memberof AuthPack
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    AuthPack.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        if (message.cipherText != null && message.hasOwnProperty("cipherText"))
            if (!$util.isString(message.cipherText))
                return "cipherText: string expected";
        if (message.secretKey != null && message.hasOwnProperty("secretKey"))
            if (!$util.isString(message.secretKey))
                return "secretKey: string expected";
        return null;
    };

    /**
     * Creates an AuthPack message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof AuthPack
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {AuthPack} AuthPack
     */
    AuthPack.fromObject = function fromObject(object) {
        if (object instanceof $root.AuthPack)
            return object;
        let message = new $root.AuthPack();
        if (object.cipherText != null)
            message.cipherText = String(object.cipherText);
        if (object.secretKey != null)
            message.secretKey = String(object.secretKey);
        return message;
    };

    /**
     * Creates a plain object from an AuthPack message. Also converts values to other types if specified.
     * @function toObject
     * @memberof AuthPack
     * @static
     * @param {AuthPack} message AuthPack
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    AuthPack.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        let object = {};
        if (options.defaults) {
            object.cipherText = "";
            object.secretKey = "";
        }
        if (message.cipherText != null && message.hasOwnProperty("cipherText"))
            object.cipherText = message.cipherText;
        if (message.secretKey != null && message.hasOwnProperty("secretKey"))
            object.secretKey = message.secretKey;
        return object;
    };

    /**
     * Converts this AuthPack to JSON.
     * @function toJSON
     * @memberof AuthPack
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    AuthPack.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for AuthPack
     * @function getTypeUrl
     * @memberof AuthPack
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    AuthPack.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/AuthPack";
    };

    return AuthPack;
})();

export const Request = $root.Request = (() => {

    /**
     * Properties of a Request.
     * @exports IRequest
     * @interface IRequest
     * @property {IHeader|null} [header] Request header
     * @property {IAuthPack|null} [auth] Request auth
     * @property {IChatPack|null} [chat] Request chat
     */

    /**
     * Constructs a new Request.
     * @exports Request
     * @classdesc Represents a Request.
     * @implements IRequest
     * @constructor
     * @param {IRequest=} [properties] Properties to set
     */
    function Request(properties) {
        if (properties)
            for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * Request header.
     * @member {IHeader|null|undefined} header
     * @memberof Request
     * @instance
     */
    Request.prototype.header = null;

    /**
     * Request auth.
     * @member {IAuthPack|null|undefined} auth
     * @memberof Request
     * @instance
     */
    Request.prototype.auth = null;

    /**
     * Request chat.
     * @member {IChatPack|null|undefined} chat
     * @memberof Request
     * @instance
     */
    Request.prototype.chat = null;

    // OneOf field names bound to virtual getters and setters
    let $oneOfFields;

    /**
     * Request pack.
     * @member {"auth"|"chat"|undefined} pack
     * @memberof Request
     * @instance
     */
    Object.defineProperty(Request.prototype, "pack", {
        get: $util.oneOfGetter($oneOfFields = ["auth", "chat"]),
        set: $util.oneOfSetter($oneOfFields)
    });

    /**
     * Creates a new Request instance using the specified properties.
     * @function create
     * @memberof Request
     * @static
     * @param {IRequest=} [properties] Properties to set
     * @returns {Request} Request instance
     */
    Request.create = function create(properties) {
        return new Request(properties);
    };

    /**
     * Encodes the specified Request message. Does not implicitly {@link Request.verify|verify} messages.
     * @function encode
     * @memberof Request
     * @static
     * @param {IRequest} message Request message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Request.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.header != null && Object.hasOwnProperty.call(message, "header"))
            $root.Header.encode(message.header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
        if (message.auth != null && Object.hasOwnProperty.call(message, "auth"))
            $root.AuthPack.encode(message.auth, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
        if (message.chat != null && Object.hasOwnProperty.call(message, "chat"))
            $root.ChatPack.encode(message.chat, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
        return writer;
    };

    /**
     * Encodes the specified Request message, length delimited. Does not implicitly {@link Request.verify|verify} messages.
     * @function encodeDelimited
     * @memberof Request
     * @static
     * @param {IRequest} message Request message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Request.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a Request message from the specified reader or buffer.
     * @function decode
     * @memberof Request
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {Request} Request
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Request.decode = function decode(reader, length, error) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Request();
        while (reader.pos < end) {
            let tag = reader.uint32();
            if (tag === error)
                break;
            switch (tag >>> 3) {
            case 1: {
                    message.header = $root.Header.decode(reader, reader.uint32());
                    break;
                }
            case 2: {
                    message.auth = $root.AuthPack.decode(reader, reader.uint32());
                    break;
                }
            case 3: {
                    message.chat = $root.ChatPack.decode(reader, reader.uint32());
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a Request message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof Request
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {Request} Request
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Request.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a Request message.
     * @function verify
     * @memberof Request
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    Request.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        let properties = {};
        if (message.header != null && message.hasOwnProperty("header")) {
            let error = $root.Header.verify(message.header);
            if (error)
                return "header." + error;
        }
        if (message.auth != null && message.hasOwnProperty("auth")) {
            properties.pack = 1;
            {
                let error = $root.AuthPack.verify(message.auth);
                if (error)
                    return "auth." + error;
            }
        }
        if (message.chat != null && message.hasOwnProperty("chat")) {
            if (properties.pack === 1)
                return "pack: multiple values";
            properties.pack = 1;
            {
                let error = $root.ChatPack.verify(message.chat);
                if (error)
                    return "chat." + error;
            }
        }
        return null;
    };

    /**
     * Creates a Request message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof Request
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {Request} Request
     */
    Request.fromObject = function fromObject(object) {
        if (object instanceof $root.Request)
            return object;
        let message = new $root.Request();
        if (object.header != null) {
            if (typeof object.header !== "object")
                throw TypeError(".Request.header: object expected");
            message.header = $root.Header.fromObject(object.header);
        }
        if (object.auth != null) {
            if (typeof object.auth !== "object")
                throw TypeError(".Request.auth: object expected");
            message.auth = $root.AuthPack.fromObject(object.auth);
        }
        if (object.chat != null) {
            if (typeof object.chat !== "object")
                throw TypeError(".Request.chat: object expected");
            message.chat = $root.ChatPack.fromObject(object.chat);
        }
        return message;
    };

    /**
     * Creates a plain object from a Request message. Also converts values to other types if specified.
     * @function toObject
     * @memberof Request
     * @static
     * @param {Request} message Request
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    Request.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        let object = {};
        if (options.defaults)
            object.header = null;
        if (message.header != null && message.hasOwnProperty("header"))
            object.header = $root.Header.toObject(message.header, options);
        if (message.auth != null && message.hasOwnProperty("auth")) {
            object.auth = $root.AuthPack.toObject(message.auth, options);
            if (options.oneofs)
                object.pack = "auth";
        }
        if (message.chat != null && message.hasOwnProperty("chat")) {
            object.chat = $root.ChatPack.toObject(message.chat, options);
            if (options.oneofs)
                object.pack = "chat";
        }
        return object;
    };

    /**
     * Converts this Request to JSON.
     * @function toJSON
     * @memberof Request
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    Request.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for Request
     * @function getTypeUrl
     * @memberof Request
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    Request.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/Request";
    };

    return Request;
})();

export const RespPack = $root.RespPack = (() => {

    /**
     * Properties of a RespPack.
     * @exports IRespPack
     * @interface IRespPack
     * @property {number|null} [code] RespPack code
     * @property {string|null} [message] RespPack message
     * @property {string|null} [data] RespPack data
     */

    /**
     * Constructs a new RespPack.
     * @exports RespPack
     * @classdesc Represents a RespPack.
     * @implements IRespPack
     * @constructor
     * @param {IRespPack=} [properties] Properties to set
     */
    function RespPack(properties) {
        if (properties)
            for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * RespPack code.
     * @member {number} code
     * @memberof RespPack
     * @instance
     */
    RespPack.prototype.code = 0;

    /**
     * RespPack message.
     * @member {string} message
     * @memberof RespPack
     * @instance
     */
    RespPack.prototype.message = "";

    /**
     * RespPack data.
     * @member {string} data
     * @memberof RespPack
     * @instance
     */
    RespPack.prototype.data = "";

    /**
     * Creates a new RespPack instance using the specified properties.
     * @function create
     * @memberof RespPack
     * @static
     * @param {IRespPack=} [properties] Properties to set
     * @returns {RespPack} RespPack instance
     */
    RespPack.create = function create(properties) {
        return new RespPack(properties);
    };

    /**
     * Encodes the specified RespPack message. Does not implicitly {@link RespPack.verify|verify} messages.
     * @function encode
     * @memberof RespPack
     * @static
     * @param {IRespPack} message RespPack message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    RespPack.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.code != null && Object.hasOwnProperty.call(message, "code"))
            writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code);
        if (message.message != null && Object.hasOwnProperty.call(message, "message"))
            writer.uint32(/* id 2, wireType 2 =*/18).string(message.message);
        if (message.data != null && Object.hasOwnProperty.call(message, "data"))
            writer.uint32(/* id 3, wireType 2 =*/26).string(message.data);
        return writer;
    };

    /**
     * Encodes the specified RespPack message, length delimited. Does not implicitly {@link RespPack.verify|verify} messages.
     * @function encodeDelimited
     * @memberof RespPack
     * @static
     * @param {IRespPack} message RespPack message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    RespPack.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a RespPack message from the specified reader or buffer.
     * @function decode
     * @memberof RespPack
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {RespPack} RespPack
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    RespPack.decode = function decode(reader, length, error) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        let end = length === undefined ? reader.len : reader.pos + length, message = new $root.RespPack();
        while (reader.pos < end) {
            let tag = reader.uint32();
            if (tag === error)
                break;
            switch (tag >>> 3) {
            case 1: {
                    message.code = reader.int32();
                    break;
                }
            case 2: {
                    message.message = reader.string();
                    break;
                }
            case 3: {
                    message.data = reader.string();
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a RespPack message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof RespPack
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {RespPack} RespPack
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    RespPack.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a RespPack message.
     * @function verify
     * @memberof RespPack
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    RespPack.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        if (message.code != null && message.hasOwnProperty("code"))
            if (!$util.isInteger(message.code))
                return "code: integer expected";
        if (message.message != null && message.hasOwnProperty("message"))
            if (!$util.isString(message.message))
                return "message: string expected";
        if (message.data != null && message.hasOwnProperty("data"))
            if (!$util.isString(message.data))
                return "data: string expected";
        return null;
    };

    /**
     * Creates a RespPack message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof RespPack
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {RespPack} RespPack
     */
    RespPack.fromObject = function fromObject(object) {
        if (object instanceof $root.RespPack)
            return object;
        let message = new $root.RespPack();
        if (object.code != null)
            message.code = object.code | 0;
        if (object.message != null)
            message.message = String(object.message);
        if (object.data != null)
            message.data = String(object.data);
        return message;
    };

    /**
     * Creates a plain object from a RespPack message. Also converts values to other types if specified.
     * @function toObject
     * @memberof RespPack
     * @static
     * @param {RespPack} message RespPack
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    RespPack.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        let object = {};
        if (options.defaults) {
            object.code = 0;
            object.message = "";
            object.data = "";
        }
        if (message.code != null && message.hasOwnProperty("code"))
            object.code = message.code;
        if (message.message != null && message.hasOwnProperty("message"))
            object.message = message.message;
        if (message.data != null && message.hasOwnProperty("data"))
            object.data = message.data;
        return object;
    };

    /**
     * Converts this RespPack to JSON.
     * @function toJSON
     * @memberof RespPack
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    RespPack.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for RespPack
     * @function getTypeUrl
     * @memberof RespPack
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    RespPack.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/RespPack";
    };

    return RespPack;
})();

export const Response = $root.Response = (() => {

    /**
     * Properties of a Response.
     * @exports IResponse
     * @interface IResponse
     * @property {IHeader|null} [header] Response header
     * @property {string|null} [pushPack] Response pushPack
     * @property {IRespPack|null} [resp] Response resp
     */

    /**
     * Constructs a new Response.
     * @exports Response
     * @classdesc Represents a Response.
     * @implements IResponse
     * @constructor
     * @param {IResponse=} [properties] Properties to set
     */
    function Response(properties) {
        if (properties)
            for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * Response header.
     * @member {IHeader|null|undefined} header
     * @memberof Response
     * @instance
     */
    Response.prototype.header = null;

    /**
     * Response pushPack.
     * @member {string|null|undefined} pushPack
     * @memberof Response
     * @instance
     */
    Response.prototype.pushPack = null;

    /**
     * Response resp.
     * @member {IRespPack|null|undefined} resp
     * @memberof Response
     * @instance
     */
    Response.prototype.resp = null;

    // OneOf field names bound to virtual getters and setters
    let $oneOfFields;

    /**
     * Response pack.
     * @member {"pushPack"|"resp"|undefined} pack
     * @memberof Response
     * @instance
     */
    Object.defineProperty(Response.prototype, "pack", {
        get: $util.oneOfGetter($oneOfFields = ["pushPack", "resp"]),
        set: $util.oneOfSetter($oneOfFields)
    });

    /**
     * Creates a new Response instance using the specified properties.
     * @function create
     * @memberof Response
     * @static
     * @param {IResponse=} [properties] Properties to set
     * @returns {Response} Response instance
     */
    Response.create = function create(properties) {
        return new Response(properties);
    };

    /**
     * Encodes the specified Response message. Does not implicitly {@link Response.verify|verify} messages.
     * @function encode
     * @memberof Response
     * @static
     * @param {IResponse} message Response message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Response.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.header != null && Object.hasOwnProperty.call(message, "header"))
            $root.Header.encode(message.header, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
        if (message.pushPack != null && Object.hasOwnProperty.call(message, "pushPack"))
            writer.uint32(/* id 2, wireType 2 =*/18).string(message.pushPack);
        if (message.resp != null && Object.hasOwnProperty.call(message, "resp"))
            $root.RespPack.encode(message.resp, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
        return writer;
    };

    /**
     * Encodes the specified Response message, length delimited. Does not implicitly {@link Response.verify|verify} messages.
     * @function encodeDelimited
     * @memberof Response
     * @static
     * @param {IResponse} message Response message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Response.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a Response message from the specified reader or buffer.
     * @function decode
     * @memberof Response
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {Response} Response
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Response.decode = function decode(reader, length, error) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        let end = length === undefined ? reader.len : reader.pos + length, message = new $root.Response();
        while (reader.pos < end) {
            let tag = reader.uint32();
            if (tag === error)
                break;
            switch (tag >>> 3) {
            case 1: {
                    message.header = $root.Header.decode(reader, reader.uint32());
                    break;
                }
            case 2: {
                    message.pushPack = reader.string();
                    break;
                }
            case 3: {
                    message.resp = $root.RespPack.decode(reader, reader.uint32());
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a Response message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof Response
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {Response} Response
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Response.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a Response message.
     * @function verify
     * @memberof Response
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    Response.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        let properties = {};
        if (message.header != null && message.hasOwnProperty("header")) {
            let error = $root.Header.verify(message.header);
            if (error)
                return "header." + error;
        }
        if (message.pushPack != null && message.hasOwnProperty("pushPack")) {
            properties.pack = 1;
            if (!$util.isString(message.pushPack))
                return "pushPack: string expected";
        }
        if (message.resp != null && message.hasOwnProperty("resp")) {
            if (properties.pack === 1)
                return "pack: multiple values";
            properties.pack = 1;
            {
                let error = $root.RespPack.verify(message.resp);
                if (error)
                    return "resp." + error;
            }
        }
        return null;
    };

    /**
     * Creates a Response message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof Response
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {Response} Response
     */
    Response.fromObject = function fromObject(object) {
        if (object instanceof $root.Response)
            return object;
        let message = new $root.Response();
        if (object.header != null) {
            if (typeof object.header !== "object")
                throw TypeError(".Response.header: object expected");
            message.header = $root.Header.fromObject(object.header);
        }
        if (object.pushPack != null)
            message.pushPack = String(object.pushPack);
        if (object.resp != null) {
            if (typeof object.resp !== "object")
                throw TypeError(".Response.resp: object expected");
            message.resp = $root.RespPack.fromObject(object.resp);
        }
        return message;
    };

    /**
     * Creates a plain object from a Response message. Also converts values to other types if specified.
     * @function toObject
     * @memberof Response
     * @static
     * @param {Response} message Response
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    Response.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        let object = {};
        if (options.defaults)
            object.header = null;
        if (message.header != null && message.hasOwnProperty("header"))
            object.header = $root.Header.toObject(message.header, options);
        if (message.pushPack != null && message.hasOwnProperty("pushPack")) {
            object.pushPack = message.pushPack;
            if (options.oneofs)
                object.pack = "pushPack";
        }
        if (message.resp != null && message.hasOwnProperty("resp")) {
            object.resp = $root.RespPack.toObject(message.resp, options);
            if (options.oneofs)
                object.pack = "resp";
        }
        return object;
    };

    /**
     * Converts this Response to JSON.
     * @function toJSON
     * @memberof Response
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    Response.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for Response
     * @function getTypeUrl
     * @memberof Response
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    Response.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/Response";
    };

    return Response;
})();

export { $root as default };
